﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Storage;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Settings Flyout item template is documented at http://go.microsoft.com/fwlink/?LinkId=273769

namespace CorpStore.Controls
{
    public sealed partial class AboutFlyout : SettingsFlyout
    {
        public string ReadmeText { get; set; }
        public string CurrentVersionNum { get; set; }

        public AboutFlyout()
        {
            this.InitializeComponent();

            // set some UI
            txtAppName.Text = App.StoreTitle;
            txtVersionNum.Text = StoreHelper.GenLib.GetExeVer();
            txtLocalState.Text = ApplicationData.Current.LocalFolder.Path;
        }

        private async void btnShowReadme_Click(object sender, RoutedEventArgs e)
        {
            this.Width = 800;
            StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///Doc/ReleaseNotes.txt"));
            string rawData = await FileIO.ReadTextAsync(file);

            txtReadme.Text = rawData;
            brdReadme.Visibility = Windows.UI.Xaml.Visibility.Visible;
        }


    }
}
